<?php


namespace App\Http\Controllers\Admin;
use App\Http\Controllers\BaseController;
use App\Models\Notification;
use Dingo\Api\Http\Request;

class NotificationController extends BaseController
{
    public $model = Notification::class;


    public function index(Request $request)
    {
        $start_at = $request->input('start_at');
        $end_at = $request->input('end_at');
        $users = Notification::startAt($start_at)
            ->endAt($end_at)->where('is_system', Notification::IS_SYSTEM)
            ->where('entity_user_id', 0)->orderBy("id", "desc")
            ->paginate(\request('per_page', 20));
        return $this->paginate($users);
    }



    public function store(Request $request) {
        $input = $request->input();
        $input['is_system'] = 1;
        $info = $this->model::create($input);
        $id = $info->id;
        return $this->success($id);
    }



}

